<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			.a{
				width: 100px;
				height: 100px;
				background-color: red;
			}
			
			.b{
				width: 200px;
				height: 100px;
				background-color: red;
			}
		</style>
		
		<script>
			window.onload = function()
			{
				let btn = document.querySelector('button');
				let div = document.querySelector('div');
				
				btn.onclick = function()
				{
					div.setAttribute("style", "width:12px");
				}
			}
		</script>
	</head>
	<body>
		<button>按钮</button>
		<div class = "a"></div>
	</body>
</html>